/** @format */

import {AppRegistry, AsyncStorage} from 'react-native';
import App from './App';
import {name as appName} from './app.json';
import {TeaNavigator} from 'teaset';

import Start from './src/MainScreen'
import RegisterPage from './src/RegisterPage'
import LoginPage from './src/LoginPage'
import React, {Component} from 'react';

import WebcomePage from './src/WebcomePage'
import QIDongPage from './src/QIDongPage'

export class index extends Component {

    componentDidMount() {
        // do stuff while splash screen is shown
        // After having done stuff (such as async tasks) hide the splash screen
        console.log("RN in index.js");
        // SplashScreen.hide();


    }

    constructor(props) {

        super(props);


        this.state = {

            isloadjs: 0,

        };

    }

    async componentDidMount() { // 检测是否为第一次打开
        AsyncStorage.getItem('person', (error, result) => {
            if (error) {
                // alert('读取失败')
            } else {
                console.log(result)
                let jsonValue = JSON.parse(result);

                var isloadjs = jsonValue ? jsonValue.islond : 0;

                if (isloadjs == 1) {

                    this.setState({
                        isloadjs: 1
                    });

                }

            }
        })
    }


    render() {


        return (
            <TeaNavigator rootView={

                <QIDongPage flag={this.props.flag}/>

            }/>
        );
    }
}


AppRegistry.registerComponent(appName, () => index);
